<div class="order-list-page" ng-if="pagedata.op == 'list'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">待服务订单</div>
		<div class="fui-header-right"></div>
	</div>
	<div class='fui-content order-list' style="top:0">
		<div class="fui-list-group order-item" ng-repeat="item in pagedata.list">
					<div ng-if="item.orderinfo.store.title" class="fui-list" style="padding-bottom:0">
                        <div class="fui-list-angle">
                            <i class="icon jinyunicon icon-dianpu"></i> {{item.orderinfo.store.title || '服务门店'}}
							<div href="tel:{{item.orderinfo.store.tel || item.orderinfo.store.mobile}}" class="subtitle" style="line-height:1;font-size:0.6rem"><i class="icon icon-phone" style="font-size:0.6rem"></i> {{item.orderinfo.store.tel || item.orderinfo.store.mobile}}</div>
						</div>
						<div class="fui-list-inner" ng-click="pagedata.openLocation(item.orderinfo.store);">
							<span class="status noremark" style="font-size:0.55rem"><i class="icon icon-map" style="font-size:0.50rem"></i> <span style="color:#f60;">{{item.orderinfo.store.address || '无'}}</span></span>
						</div>
                    </div>
                    <div ng-repeat="g in item.orderinfo.goods" class="fui-list goods-list">
                            <div class="fui-list-media" style="">
                                <img class="" ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}"/>
                            </div>
                            <div class="fui-list-inner">
                                <div class="text goodstitle towline">{{g.goods_title}}</div>
								<div class="text syscolor">{{g.optiontitle || '无'}}</div>
                            </div>
                            <div class="fui-list-angle" style="width:3rem">
                                ￥<span class="marketprice">{{g.totalprice}}</span>
							</div>
                    </div>
					<div class="title" style="padding:0 0.5rem">
						<div><i class="icon icon-trade" style="font-size: 0.65rem"> 服务费：<span class="price red">￥**.**</span></i></div>
						<div><i class="icon icon-trade" style="font-size: 0.65rem"> 服务时间：<span class="red">{{item.orderinfo.serve_time}}</span></i></div>
						<div class="subtitle"><i class="icon icon-shijian" style="font-size: 0.65rem">下单时间：{{item.createtime}}</i></div>
					</div>
					<div class="fui-list">
                        <div class="fui-list-inner">
							<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-wo1"></i> 联系人： <span class="text-danger">******  </span>；  联系电话： <a href="tel:{{item.order_out.mobile}}" class="text-danger">1**********</a></div>
							<span style="color:#999;font-size:0.65rem"><i class="icon icon-ditu"></i> 服务地址： <span class="text-danger">{{item.orderinfo.addresstext}}</span></span>
							<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-liaotian"></i> 备注： <span class="text-danger">{{item.orderinfo.remark || '无'}}  </span></div>
							<div ng-if="item.orderinfo.images.length>0" class="weui_uploader_bd" style="margin-bottom:0">
									<ul class="weui_uploader_files" ng-click="previewImage(item.orderinfo.images[0],item.orderinfo.images);">
										<li ng-repeat="p in item.orderinfo.images" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')"></li>
									</ul>
							</div>
						</div>
					</div>
					<div class="fui-list-group-title lineblock opblock">
						<span class="status noremark">
							<div class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="post({},'getorder','id='+item.id)">接收订单</div>
						</span>
					</div>
        </div>
	</div>
	<div class="content-empty" ng-show="pagedata.list.length == 0 ">
		  <i class="icon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有订单！</p>
	</div>
</div>
<div class="fui-navbar">
	<a href="javascript:;" ng-click="access_json('jy_wxshifu/shifu_order/')" class="nav-item" style="background:#00c568;color:#fff">立即抢单</a>
	<a href="javascript:;" ng-click="access_json('jy_wxshifu/worker_order/')" class="nav-item" style="background:red;color:#fff">我的服务</a>
</div>
<div class="fe-floatright-bottom" style="bottom:5rem">
<a ng-if="pagedata.isopenvoice!=1" ng-click="pagedata.isopenvoice=1;pagedata.openvoice(true)" href="javascript:;"><i class="icon icon-nolingsheng0"></i></a>
<a ng-if="pagedata.isopenvoice==1" ng-click="pagedata.isopenvoice=0;pagedata.openvoice(false)" href="javascript:;"><i class="icon icon-lingsheng0"></i></a> 
</div>
<audio id="openvoice" controls preload="auto" style="display:none;">
	<source src="../core/resource/images/neworder.mp3"></source>
</audio>
<script>
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){
    jinyun_socket.connect(function(){
        jinyun_socket.join('shifu_order');//加入ID为1的组
     });
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.tool.get_list('jy_wxshifu/shifu_order/list/',true);
    }
});
scope.tool.get_list('jy_wxshifu/shifu_order/list/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_wxshifu/shifu_order/list/');
}
scope.pagedata.openvoice=function(type){
	var voicetime = {};
    var openvoice;
	if(type || scope.pagedata.isopenvoice==1){
		 openvoice = setInterval(() => {
			if(scope.pagedata.isopenvoice!=1){
				clearInterval(openvoice);
				return false;
			}
			scope.get('jy_wxshifu/index/getnew/',function(res){
						console.log('openvoice');console.log(res);
						if(res!='none'){
							if(!voicetime[res.id]){
								voicetime[res.id]=1;
								$("#openvoice")[0].play();
							}
							if(scope.pagedata.status==2){
								scope.tool.get_list('jy_wxshifu/worker_order/list/status='+scope.pagedata.status,true);
							}
						}
			});
		}, 5000);
	}else{
		scope.get('jy_wxshifu/index/setopenvoice/isopenvoice=0',function(res){});
	}
}
scope.pagedata.openvoice();
</script>